package xin.marcher.module.common.constants.diplomacy;

/**
 * 缓存key
 */
public abstract class AbstractRedisKeyConstants {

    private AbstractRedisKeyConstants() {
        throw new IllegalStateException("AbstractRedisKeyConstants class");
    }

    /**
     * 商品布隆过滤
     * key：skuId
     */
    public static final String PRODUCT_SKU_INFO_BLOOM = "PRODUCT_SKU_INFO_BLOOM";

    /**
     * 商品明细 缓存
     * key：skuId
     */
    public static final String PRODUCT_SKU_INFO_STRING = "PRODUCT_SKU_INFO_STRING:%s";

    /**
     * sku缓存
     * key：skuId
     */
    public static final String SKU_INFO_STRING = "SKU_INFO_STRING:%s";

    /**
     * item缓存
     * key：itemId
     */
    public static final String ITEM_INFO_STRING = "ITEM_INFO_STRING:%s";

    /**
     * 可售skuId
     * key：sellerId
     * value：sku
     */
    public static final String SELLER_SALE_SKU_ZSET = "SELLER_SALE_SKU_ZSET:%s";

    /**
     * 卖家类型可售skuId
     * key：sellerId
     * value：sku
     */
    public static final String SELLER_TYPE_SALE_SKU_ZSET = "SELLER_TYPE_SALE_SKU_ZSET:%s";

    /**
     * 卖家类型可采skuId
     * key：sellerId
     * value：sku
     */
    public static final String SELLER_RECOVERABLE_SKU_ZSET = "SELLER_RECOVERABLE_SKU_ZSET:%s";

    /**
     * 卖家类型可补skuId
     * key：sellerId
     * value：sku
     */
    public static final String SELLER_COMPENSATION_SKU_ZSET = "SELLER_COMPENSATION_SKU_ZSET:%s";

    /**
     * 卖家库存预警的skuId
     * key：sellerId
     * value：sku
     */
    public static final String SELLER_WARNING_INVENTORY_SKU_ZSET = "SELLER_WARNING_INVENTORY_SKU_ZSET:%s";

    /**
     * 商品品类
     * key：categoryId
     */
    public static final String CATEGORY_BASE_STRING = "CATEGORY_BASE_STRING:%s";

    /**
     * 类目
     * key：类目ID
     */
    public static final String FRONT_CATEGORY_STRING = "FRONT_CATEGORY_STRING:%s";

    /**
     * 类目与商品关系
     * key：itemId
     */
    public static final String FRONT_CATEGORY_ITEM_RELATION_SET = "FRONT_CATEGORY_ITEM_RELATION_SET:%s";

    /**
     * 卖家商品价格
     * key：
     */
    public static final String SKU_PRICE_SELLER_RELATION_STRING = "SKU_PRICE_SELLER_RELATION_STRING:%s";

    /**
     * 前台类目与品标签关系
     * key：
     */
    public static final String FRONT_CATEGORY_LABEL_RELATION_STRING = "FRONT_CATEGORY_LABEL_RELATION_STRING:%s";

    /**
     * 标签
     * key：
     */
    public static final String LABEL_STRING = "LABEL_STRING:%s";

    /**
     * 商品与标签关系
     * key：
     */
    public static final String PRODUCT_LABEL_RELATION_STRING = "PRODUCT_LABEL_RELATION_STRING:%s";

    /**
     * 获取sku信息key
     *
     * @param skuId
     * @return java.lang.String
     */
    public static String getSkuInfoString(String skuId) {
        return String.format(SKU_INFO_STRING, skuId);
    }

    /**
     * 获取卖家下可售商品 key
     *
     * @param sellerId
     * @return java.lang.String
     */
    public static String getSellerSaleSkuZsetKey(Object sellerId) {
        return String.format(SELLER_SALE_SKU_ZSET, sellerId);
    }

    /**
     * 获取卖家类型的可售商品 key
     *
     * @param sellerId
     * @return java.lang.String
     */
    public static <T> String getSellerTypeSaleSkuZsetKey(T sellerId) {
        return String.format(SELLER_TYPE_SALE_SKU_ZSET, sellerId);
    }

    /**
     * 获取卖家类型的可采商品 key
     *
     * @param sellerId
     * @return java.lang.String
     */
    public static <T> String getSellerTypePurchaseSkuZsetKey(T sellerId) {
        return String.format(SELLER_RECOVERABLE_SKU_ZSET, sellerId);
    }

    /**
     * 获取卖家类型的可采商品 key
     *
     * @param sellerId
     * @return java.lang.String
     */
    public static <T> String getSellerTypeCompensateSkuZsetKey(T sellerId) {
        return String.format(SELLER_COMPENSATION_SKU_ZSET, sellerId);
    }

    /**
     * 获取卖家库存预警的sku key
     *
     * @param sellerId
     * @return java.lang.String
     */
    public static <T> String getWarningInventoryZsetKey(T sellerId) {
        return String.format(SELLER_WARNING_INVENTORY_SKU_ZSET, sellerId);
    }

    /**
     * 获取类目信息缓存key
     *
     * @param id 类目ID
     */
    public static String getFrontCategoryStringKey(Integer id) {
        return String.format(FRONT_CATEGORY_STRING, id);
    }

    /**
     * 获取类目与商品关系的缓存key
     *
     * @param itemId
     */
    public static String getFrontCategoryItemRelationSetKey(String itemId) {
        return String.format(FRONT_CATEGORY_ITEM_RELATION_SET, itemId);
    }

}
